#include "RealTimeAnalysis.h"


RealTimeAnalysis::RealTimeAnalysis(int track_id,QVUMeter *meter, Manager *aManager, int startTime,QVisualizer *visu)
{
	this->aManager=aManager;
	this->meter=meter;
	this->sBar=sBar;
	this->visu=visu;
	this->connect(this,SIGNAL(updateLeftValue(double)),meter,SLOT(setLeftValue(double)));
	this->connect(this,SIGNAL(updateRightValue(double)),meter,SLOT(setRightValue(double)));
	this->start();
	this->track_id=track_id;
	this->startTime=startTime;
	start_clock = clock();
}

/*RealTimeAnalysis::RealTimeAnalysis(Metronome *metro)
{
	this->metro=metro;	
*	this->start();
}*/


RealTimeAnalysis::~RealTimeAnalysis(void)
{
}
void RealTimeAnalysis::run()
{
	do{
			float f=aManager->getTrackDB(track_id,0);
			updateLeftValue(f);
			f=aManager->getTrackDB(track_id,1);
			end = clock();
			elapsed = ((double)end - start_clock) / CLOCKS_PER_SEC;
			updateRightValue(f);
			Sleep(50);
	}while(1);
}
